package com.youbug.mall.ware_wms.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.youbug.common.vo.QueryVo;
import com.youbug.mall.ware_wms.entity.WmsWareOrderTaskDetail;
import com.youbug.mall.ware_wms.service.IWmsWareOrderTaskDetailService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.youbug.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 库存工作单 前端控制器
 * </p>
 *
 * @author youbug
 * @since 2024-07-14
 */
@RestController
@RequestMapping("/wmsWareOrderTaskDetail")
public class WmsWareOrderTaskDetailController {
@Autowired
private IWmsWareOrderTaskDetailService wmsWareOrderTaskDetailService;

    @PostMapping("/getWmsWareOrderTaskDetailPage")
    public R<IPage<WmsWareOrderTaskDetail>> getWmsWareOrderTaskDetailPage(@RequestBody QueryVo<WmsWareOrderTaskDetail> queryVo){

        IPage<WmsWareOrderTaskDetail> wmsWareOrderTaskDetails = wmsWareOrderTaskDetailService.getWmsWareOrderTaskDetailPage(queryVo);

        return R.ok(wmsWareOrderTaskDetails);
    }

    @GetMapping("/getWmsWareOrderTaskDetailById/{id}")
    public R<WmsWareOrderTaskDetail> getWmsWareOrderTaskDetailById(@PathVariable Integer id){

        WmsWareOrderTaskDetail wmsWareOrderTaskDetail = wmsWareOrderTaskDetailService.getById(id);

        return R.ok(wmsWareOrderTaskDetail);
    }

    @PostMapping("/add")
    public R<Boolean> add(@RequestBody WmsWareOrderTaskDetail wmsWareOrderTaskDetail){

        boolean save = wmsWareOrderTaskDetailService.save(wmsWareOrderTaskDetail);

        return  R.ok(save);
    }

    @PostMapping("/update")
    public R<Boolean> update(@RequestBody WmsWareOrderTaskDetail wmsWareOrderTaskDetail){

        boolean update = wmsWareOrderTaskDetailService.updateById(wmsWareOrderTaskDetail);

        return  R.ok(update);
    }

    @GetMapping("/delete/{id}")
    public R<Boolean> delete(@PathVariable Integer id){

        boolean remove = wmsWareOrderTaskDetailService.removeById(id);

        return  R.ok(remove);
    }
}

